package com.tjsinfo.tjsoa.mail.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.json.JSONObject;

import com.tjsinfo.tjsoa.common.SessionUser;
import com.tjsinfo.tjsoa.mail.bo.ITjsEmailFolderBo;
import com.tjsinfo.tjsoa.mail.bo.ITjsemailReceivedBo;
/**
 * 收件箱列表action
 * @author wangxiaowei
 *
 */
public class EmailNewReceivedAction extends Action {
	private ITjsemailReceivedBo tjsemailReceivedBo;
	private ITjsEmailFolderBo tjsEmailFolderBo;
	
	public ITjsemailReceivedBo getTjsemailReceivedBo() {
		return tjsemailReceivedBo;
	}

	public void setTjsemailReceivedBo(ITjsemailReceivedBo tjsemailReceivedBo) {
		this.tjsemailReceivedBo = tjsemailReceivedBo;
	}

	public ITjsEmailFolderBo getTjsEmailFolderBo() {
		return tjsEmailFolderBo;
	}

	public void setTjsEmailFolderBo(ITjsEmailFolderBo tjsEmailFolderBo) {
		this.tjsEmailFolderBo = tjsEmailFolderBo;
	}

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
	        throws Exception {
		Integer count=tjsemailReceivedBo.count(String.valueOf(SessionUser.getUserId(request)),1);
		JSONObject object = new JSONObject();
    	object.put("count", count);
    	response.getWriter().print(object);
		return null;
	}
}
